<!--<?php
print <<<EOT
-->

<script src="css/edit.js"></script>
<script>
<!--
function printall(id, subid) {
    if(subid>0) {
        url = "printall.php?categoryid="+id+"&subcategoryid="+subid;
    } else { 
        url = "printall.php?categoryid="+id;
    }
    open(url);
}

function addWishlist(id, code) {
    url = "wishlist_view.php?act=add&pid="+id+"&code="+code;
    document.getElementById('addwishlistiframe').src=url;
}
function addCart(id) {
    var buy_num = $("#txtPNum"+id).val();
    var fitemid = $("#selFinish"+id).val();
    if(fitemid == 0 && $("#selFinish"+id).children().size() > 0)
    {
        alert('Please select a finish!');
        $("#selFinish"+id).focus();
        return false;
    }
    else if (!IsNumber(buy_num)||buy_num==0)
	 {
        alert('请输入订购数量！');
        $("#txtPNum"+id).focus();
        return false;
    } else {
        url = "cart_view.php?act=add&inventorytype=0&inventoryid=0&pid="+id+"&js=1&addnum="+buy_num+"&fitemid="+fitemid;
        document.getElementById('addtocontentiframe').src=url;
    }
}
//function validate(tform) {

//    var id_ary = $js_id_ary_str;
//    var qty_flag = 0;
//    
//    for (var i=0; i<id_ary.length; i++) {
//        
//        if (document.all('p_num['+id_ary[i]+']').value != '' && isDigit(document.all('p_num['+id_ary[i]+']').value) && parseInt(document.all('p_num['+id_ary[i]+']').value) > 0) {
//            qty_flag = 1;            
//        }       
//    }
//    
//    if (qty_flag == 0) {
//        alert('Please enter the order qty !');
//        return false;
//    }
//    
//    return true;
//   
//}
//-->
</script>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
//-->
</script>              
             
             $postiondiv 
	            <div class="main_search">					 
                $page_search
                <div align="center" class="paging_bar">{$PagerString}</div>
	            </div>
                 <div class="main">	 
                 <div class="lst_nav">	               
	           $category_list          
               {$EnglishLink}
			      <br/>
                  <br/>  
                 </div>
                 
                <div class="lst_listing">
                                
                  <iframe name='addwishlistiframe' width=0 height=0 src="about:blank" id='addwishlistiframe' style="display:none"></iframe>
                  <iframe name='addtocontentiframe' width=0 height=0 src="about:blank" id='addtocontentiframe' style="display:none"></iframe>                  
                  <table width="745" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="5"><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td>
                      <td bgcolor="FFFFFF" width="10"><img name="" src="./images/spacer.gif" width="10" height="10" alt=""></td>
                      <td bgcolor="FFFFFF" width="548">
                      
                     
                      
                        <table width="538" border="0" cellspacing="0" cellpadding="0">
                         
                          <tr>
                            <td><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td>
                          </tr>
                          <tr>
                            <td align="center" class="pageTitleText">{$page_show['str']}</td>
                          </tr>                          
                          <tr>
                            <td align="center" class="pageListings"></td>
                          </tr>
                        </table>
                        <div><img name="" src="./images/spacer.gif" width="538" height="5" alt=""></div></td>
                      <td bgcolor="FFFFFF" width="10"><img name="" src="./images/spacer.gif" width="10" height="10" alt=""></td>
                     
                    </tr>
                    
                  </table>
                  <div><img name="" src="./images/spacer.gif" width="568" height="4" alt=""></div>
                  
                  <!--<form action="cart_view.php" method="post" name="form1" onSubmit="return validate(this)" target="addtocontentiframe">-->
    	    	  <input type="hidden" name="act" value="adddate">
    	    	  <input type="hidden" name="inventoryid" value="0">
    	    	  <input type="hidden" name="inventorytype" value="0">
    	    	  <input type="hidden" name="intype" value="0">
    	    	  <input type="hidden" name="js" value="1">
                  <table width="745" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="5"></td>
                      <td width="136"></td>
                      <td width="136"></td>
                      <td width="136"></td>
                      <td width="136"></td>
                      <td width="4"></td>
                    </tr>
                    <tr>
                      <td width="5"><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td>

               
<!--
EOT;
$index = 1;
foreach ($photo_ary as $k=>$v) {
    $str = '';
    if ($index%4 == 0 && $index>3) {
        $str       = '<td width="4"><img name="" src="./images/spacer.gif" width="4" height="4" alt=""></td>
                    </tr>
                    
                    <tr>
                      <td width="5"><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td width="4"><img name="" src="./images/spacer.gif" width="4" height="4" alt=""></td>
                    </tr>
                    <tr>
                      <td width="5"><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td>';
        
    } else {
        $str = '';    
    }
    $start_limit_1 = $start_limit+$index;
    if (trim($v['small_pic']) == "" || !file_exists("attachments/" . $v['small_pic'])) {
        $v['small_pic'] = 'noCN.gif';
    }
    $price_show = '';
    if ($jansen_type==2) {
    	$v['price_2'] = number_format($v['price_2'], 2, '.', ',');
    	/*$price_show = '<div>MCP: ' . (float)$v['price_1'] . ' (美金)</div>
	                   <div>DCP: ' . (float)$v['price_2'] . ' (美金)</div>';*/
    	$price_show = '<tr><td>美金</td><td> </td><td> <span class="EnTextFamily">' . $v['price_2'] . '</span></td>';
    } elseif ($jansen_type == 1) {
    	$v['price_3'] = number_format($v['price_3'], 2, '.', ',');
    	//$price_show = '<div>HKWSP: ' . (float)$v['price_3'] . ' (HKD)</div>';
    	$price_show = '<tr><td><span class="EnTextFamily">HKD</span></td><td align="center"></td><td> <span class="EnTextFamily">' . $v['price_3'] . ' </span></td></tr>';
    }
    $product_name_show = '';
	/*if($v['namezh']!='')
	{
		$product_name_show = '<div style=\"min-height:30px;height:30px;overflow:hidden;line-height:15px;\">'.$v['namezh'].'</div>';
	}
	else if($v['name']!='')
	{
	  $product_name_show = '<div style=\"min-height:30px;height:30px;overflow:hidden;line-height:15px;\">'.$v['name'].'</div>';
	}*/
	$product_name_show = '<div style=\"min-height:30px;height:30px;overflow:hidden;line-height:15px;\">'.$v['namezh'].'</div>';
	
    $new_show = '';
    if ($v['new_flag'] == 1) {
        $new_show = '&nbsp;&nbsp;<span class="new_show">新产品！</span>';
    }
print <<<EOT
-->    	

    	              <td align="center" valign="top">
    	                <table width="155" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td bgcolor="FFFFFF" width="10"><img name="" src="./images/spacer.gif" width="10" height="10" alt=""></td>
                            <td bgcolor="FFFFFF" width="145"><img name="" src="./images/spacer.gif" width="115" height="10" alt=""></td>
                            
                          </tr>
                          <tr>
                            <td bgcolor="FFFFFF" width="10"><img name="" src="../images/spacer.gif" width="10" height="10" alt=""></td>
                            <td bgcolor="FFFFFF" width="145"><div><a href="product_details.php?$urlParam&pid={$v['id']}&curpage=$page#atpic"><img src="attachments/{$v['small_pic']}" alt="Image of {$v['code']}" name="jf_product_images_sm_image_{$v['id']}" width="113" height="113" class="picture" id="jf_product_images_sm_image_{$v['id']}" border="0"></a></div>
                              <div><img src="./images/spacer.gif" width="115" height="5" alt=""></div>
                              <div align="left"><a href='product_details.php?$urlParam&pid={$v['id']}&fid=$fid#atpic'><span class="EnTextFamily">{$v['code']}</span></a> {$new_show}</div>
                              <div><img src="./images/spacer.gif" width="115" height="5" alt=""></div>
                              <!--div><a href="product_details.php?categoryid=$categoryid&pid={$v['id']}&fid=$fid" onMouseOver="MM_swapImage('jf_button_view_image_{$v['id']}','','./images/button/jf_button_view_image-over.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="./images/button/jf_button_view_image.gif" alt="View Image for item " name="jf_button_view_image_{$v['id']}" width="115" height="15" border="0" id="jf_button_view_image_{$v['id']}"></a></div-->
                              $product_name_show
                                                    
                            <div>
                              <table cellspacing="0" cellpadding="0">
                              <tbody>
                               $price_show 
                              <tr><td height="25" width="35" >漆色</td>
                                      <td width="5" align="center"></td>
                                      <td><select style="width: 75px; height:17px; padding:0; margin:0;" id='selFinish{$v["id"]}' name='selFinish{$v["id"]}'>{$_finish[$v["finish_id"]]}</select></td>
                               </tr>
                               <tr>
                                  <td height="25">数量</td>
                                  <td  align="center"></td>
                                  <td><input type="text" id="txtPNum{$v['id']}" name="txtPNum{$v['id']}" style="width:75px; height:17px; padding:0; margin:0;" />   </td>
                              </tr>
                               <tr>
                                  
                                  <td height="25" colspan="3">
                                  <div class="addtocart" ><a href="javascript:;" onclick="addCart({$v['id']});">加到购物车</a>
                                 <!-- <a href="javascript:;" onclick="addWishlist('{$v['id']}', '{$v['code']}');">Add to Container</a>-->
                                 </div></td>
                                  
                              </tr>
                              </tbody></table>
                              
                              </div>
                            
                            
                            </td>
                           
                          </tr>
                          <tr>
                            <td bgcolor="FFFFFF" width="10"><img name="" src="./images/spacer.gif" width="10" height="10" alt=""></td>
                            <td bgcolor="FFFFFF" width="145"><img name="" src="./images/spacer.gif" width="115" height="10" alt=""></td>
                            
                          </tr>
                         
                        </table>
                      </td>
                      $str

<!--
EOT;
    $index++;
} 
print <<<EOT
-->                                                          
                      
                      <td width="4" valign="bottom"><img name="" src="./images/spacer.gif" width="4" height="4" alt=""></td>
                    </tr>
                    
                    <tr>
                      <td width="5"><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td align="left"><img name="" src="./images/spacer.gif" width="136" height="4" alt=""></td>
                      <td width="4"><img name="" src="./images/spacer.gif" width="4" height="4" alt=""></td>
                    </tr>
                    
<!--
EOT;
if (!empty($photo_ary)) {
print <<<EOT
-->                     
                    
                 
                  
<!--
EOT;
} else {
print <<<EOT
-->      
                    <tr height=20 valign="middle"><td width="5"><img name="" src="./images/spacer.gif" width="5" height="5" alt=""></td><td colspan=5 align="left" class=titles>&nbsp;<!--No product in this category.-->$noproductNote</td></tr>
<!--
EOT;
} 
print <<<EOT
--> 
                    
                  </table>
                 <!-- </form> -->
                  
                   
             
              
           
        
          </div>
   
      <div class="main_search" style="clear:both;" id="footPage">	
        <div  class="paging_bar">{$PagerString}</div>  	      
	    </div> 
          <br/><br/><br/>
   	</div>
	
<!--
EOT;
?>-->